<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="../css/common.css" />
<script src="../js/common/jquery.js"></script>
<script src="../js/common/drag.js"></script>
<script src="../js/common/angular.min.js"></script>
<script type="text/javascript" src="../js/common/common.js"></script>
<script type="text/javascript" src="../js/validate.js"></script>
</head>
<body ng-app="myApp">

<div class="dqwz">
    <span>当前位置：</span>
    <span>AngularJS 输入验证</span>
</div>

<section>
    <div ng-controller="validateCtrl">
        <h3>【输入验证】</h3>
        <form name="myForm" novalidate>
            <p>用户名：</p>
            <div>
                <input type="text" ng-model="user" name="user" required />
                <span ng-show="myForm.user.$dirty && myForm.user.$invalid" class="red">
                    <span ng-show="myForm.user.$error.required">用户名必填</span>
                </span>
                <span ng-show="myForm.user.$valid" class="green">填写正确</span>
            </div>
            <p>邮箱：</p>
            <div>
                <input type="email" ng-model="email" name="email" required/>
                <span ng-show="myForm.email.$dirty && myForm.email.$invalid" class="red">
                    <span ng-show="myForm.email.$error.required">邮箱必填</span>
                    <span ng-show="myForm.email.$error.email">非法的邮箱</span>
                </span>
                <span ng-show="myForm.email.$valid" class="green">填写正确</span>
            </div>
            <div>
                <input type="submit" ng-disabled="myForm.user.$dirty && myForm.user.$invalid ||
                myForm.email.$dirty && myForm.email.$invalid || myForm.user.$pristine ||
                myForm.email.$pristine"/>
            </div>
        </form>
        <!-- 查看源码开始 -->
        <div class="htmlCode">
            <span>【html源码】</span>
            <xmp ng-non-bindable>
<form name="myForm" novalidate>
    <p>用户名：</p>
    <div>
        <input type="text" ng-model="user" name="user" required />
        <span ng-show="myForm.user.$dirty && myForm.user.$invalid" class="red">
            <span ng-show="myForm.user.$error.required">用户名必填</span>
        </span>
        <span ng-show="myForm.user.$valid" class="green">填写正确</span>
    </div>
    <p>邮箱：</p>
    <div>
        <input type="email" ng-model="email" name="email" required/>
        <span ng-show="myForm.email.$dirty && myForm.email.$invalid" class="red">
            <span ng-show="myForm.email.$error.required">邮箱必填</span>
            <span ng-show="myForm.email.$error.email">非法的邮箱</span>
        </span>
        <span ng-show="myForm.email.$valid" class="green">填写正确</span>
    </div>
    <div>
        <input type="submit" ng-disabled="myForm.user.$dirty && myForm.user.$invalid ||
        myForm.email.$dirty && myForm.email.$invalid || myForm.user.$pristine ||
        myForm.email.$pristine"/>
    </div>
</form>
            </xmp>
            <span>【js源码】</span>
            <xmp>
没用啊
            </xmp>
            <span class="close"><a href="javascript:;">关闭</a></span>
        </div>
        <div class="viewCode">
            <span><a href="javascript:;"> >>查看源码</a></span>
        </div>
        <!-- 查看源码结束 -->
    </div>
</section>

<div class="mask_layer">
</div>

</body>
</html>